/* TabMenu.java 
* Created on Jan 14, 2013 
* Author:Mr.Viet
* Phone: 01683430426
* Email: phamvanvietcdhd@gmail.com
*/ 
package ServerAdmin; 

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;

import net.miginfocom.swing.MigLayout;

public class TabMenu extends JPanel implements ActionListener {
	private JButton btnStart,btnDB,btnAdmin;
	public JPanel p;
	private JSplitPane spane;
	public TabMenu() {
		this.createForm();
	}
	public void createForm(){
		this.setLayout(new BorderLayout());
		this.btnStart = new JButton("Start");
		this.btnStart.setMaximumSize(new Dimension(150,70));
		this.btnStart.setMinimumSize(new Dimension(150,70));
		this.btnDB = new JButton("Manage Database");
		this.btnDB.setMaximumSize(new Dimension(150,70));
		this.btnDB.setMinimumSize(new Dimension(150,70));
		this.btnAdmin = new JButton("Admin");
		this.btnAdmin.setMaximumSize(new Dimension(150,70));
		this.btnAdmin.setMinimumSize(new Dimension(150,70));
		JPanel p = new JPanel();
		p.setLayout(new MigLayout());
		p.add(this.btnStart,"wrap");
		p.add(this.btnDB,"wrap");
		p.add(this.btnAdmin,"wrap");
		
		this.add(BorderLayout.NORTH,new JPanel());
		this.add(BorderLayout.CENTER,p);
		
		//Dang ki su kien
		this.btnAdmin.addActionListener(this);
		this.btnDB.addActionListener(this);
		this.btnStart.addActionListener(this);
		
		this.spane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,p,new fmStart());
		this.add(this.spane);
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource() == this.btnStart){
			this.spane.setRightComponent(new fmStart());
		}
		if(e.getSource() == this.btnDB){
			this.spane.setRightComponent(new fmManageDabase());
		}
		if(e.getSource() == this.btnAdmin){
			this.spane.setRightComponent(new fmAdmin());
		}
	}
	public JPanel getJPanel(){
		return p;
	}
}
